Now that we can get analogue values into our programs the world is our oyster. You can use the Analogue to Digital converter for all kinds of interesting jobs. Here are just a few ideas that you can think about:

You could easily write a program which detects when a beam of light is broken. This could be used in a handdryer, or as a burglar alarm (use another PIC output to switch on a sounder).

You could use the software to create a "silent alarm" which you can use to detect if anyone has been messing with your stuff. This could detect the light when a drawer is opened and signal this in some way.

The PIC microcontroller development board uses the same pin for the ADC as is used for the sound output - so unfortunately you can't use that to make a sound while you sample light levels. However, it would be easy to connect something to another pin. If you did this you could make a light controlled organ where the pitch of the sound is controlled by a light.

You can use your beam breaker to measure the speed of objects. If you know how long the object is and you can measure the time it breaks the beam for as it goes past you can use your PIC microcontroller as a kind of speed camera, and detect when your cars break the limit. To do this you could use the number display we created in Lab 4, or you could settle for a bar graph display of speed. Your program would have to detect the leading edge of the object (i.e. when the beam is broken and the cell goes dark). It would then update a counter until the beam is restored and the cell goes light again. This value would be smaller the faster the object is moving.

With small modification you could get the morse reading program to accept input from the light sensor rather than a key. To do this you'd just need to modify the key fetching functions. You could then send morse messages using a torch!

The principles of using the ADC apply to the other channels which you can also sample. You could use the potentiometer to measure position or to allow the user to input an analogue value.

Finally you could use the LCD panel on the board and produce a light level meter which showed the light level as a number. You could also use such a program to create a digital voltage meter.